home *** CD-ROM | disk | FTP | other *** search
/ ftp.ncftp.com / ftp.ncftp.com.zip / ftp.ncftp.com / ncftp / binaries / Setup NcFTP 3.2.5.msi / _C8DEB57094A6B44B059F9B6C123BB40F / _9636D2966C09431186368780F4AE0C8B < prev    next >
Text File  |  2006-08-05  |  14KB  |  518 lines

  1. <HTML>
  2. <HEAD>
  3. <TITLE>ncftpspooler(1) manual page</TITLE>
  4. </HEAD>
  5. <BODY bgcolor=white>
  6.  
  7. <H2><B>Name</B></H2>
  8.  
  9. <ul>
  10. <P>
  11. <b>ncftpspooler</b> - Global batch FTP job processor daemon
  12. <P>
  13. </ul>
  14.  
  15. <H2><B>Synopsis</B></H2>
  16.  
  17. <ul>
  18. <P>
  19. <B>ncftpspooler</B> -d [<I>options</I>]
  20. <P>
  21. <P>
  22. <B>ncftpspooler</B> -l [<I>options</I>]
  23. <P>
  24. </ul>
  25. <center>
  26. <p>
  27. <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
  28. <input type="hidden" name="cmd" value="_xclick">
  29. <input type="hidden" name="business" value="sales@ncftp.com">
  30. <input type="hidden" name="item_name" value="NcFTP Client">
  31. <input type="hidden" name="item_number" value="NcFTP">
  32. <input type="hidden" name="no_shipping" value="2">
  33. <input type="hidden" name="no_note" value="1">
  34. <input type="hidden" name="currency_code" value="USD">
  35. <input type="hidden" name="tax" value="0">
  36. <input type="hidden" name="bn" value="PP-DonationsBF">
  37. <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc-donate.gif" border="0" name="submit" alt="Make a donation!">
  38. <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
  39. </form>
  40. </center>
  41.  
  42. <H2><B>Options</B></H2>
  43.  
  44. <P>
  45. Command line flags:
  46. <ul>
  47.  
  48.  
  49. <DL>
  50.  
  51. <DT><B>-d</B> </DT>
  52. <DD>     Begin background processing of FTP jobs in the
  53. designated FTP job queue directory.
  54. <P>
  55. </DD>
  56.  
  57. <DT><B>-q</B> <I>XX</I> </DT>
  58. <DD>Use this option to specify a directory to use as
  59. the FTP job queue instead of the default directory,
  60. <tt>/var/spool/ncftp</tt>.
  61. <P>
  62. </DD>
  63.  
  64. <DT><B>-o</B> <I>XX</I> </DT>
  65. <DD>Use this option to specify a filename to use as
  66. the log file. By default, (and rather inappropriately)
  67. the program simply uses a file called <I>log</I>
  68. in the job queue directory. If you don't want a
  69. log, use this option to specify
  70. <tt>/dev/null</tt>.
  71. <P>
  72. </DD>
  73.  
  74. <DT><B>-l</B> </DT>
  75. <DD>     Lists the contents of the job queue directory.
  76. <P>
  77. </DD>
  78.  
  79. <DT><B>-s</B> <I>XX</I> </DT>
  80. <DD>When the job queue is empty, the program sleeps
  81. 120 seconds and then checks again to see if a new
  82. job has been submitted. Use this option to change
  83. the number of seconds used for this delay.
  84. <P>
  85. </DD>
  86. </DL>
  87. </ul>
  88.  
  89. <H2><B>Description</B></H2>
  90.  
  91. <P>
  92. The <I>ncftpspooler</I> program evolved from the <I>ncftpbatch</I> program.
  93. The <I>ncftpbatch</I> program was originally designed as a
  94. ``personal FTP spooler'' which would process a single
  95. background job a particular user and exit when it finished;
  96. the <I>ncftpspooler</I> program is a ``global FTP
  97. spooler'' which stays running and processes background
  98. jobs as they are submitted.
  99. <P>
  100. <P>
  101. The job queue directory is monitored for specially-named
  102. and formatted text files. Each file serves as a single
  103. FTP job. The name of the job file contains the type of
  104. FTP job (<I>get</I> or <I>put</I>), a timestamp indicating the earliest
  105. the job should be processed, and optionally some additional
  106. information to make it easier to create unique job
  107. files (i.e. a sequence number). The contents of the job
  108. files have information such as the remote server machine
  109. to FTP to, username, password, remote pathname, etc.
  110. <P>
  111. <P>
  112. Your job queue directory must be readable and writable by
  113. the user that you plan to run <I>ncftpspooler</I> as, so that
  114. jobs can be removed or renamed within the queue.
  115. <P>
  116. <P>
  117. More importantly, the user that is running the program
  118. will need adequate privileges to access the local files
  119. that are involved in the FTPing. I.e., if your spooler is
  120. going to be processing jobs which upload files to remote
  121. servers, then the user will need read permission on the
  122. local files that will be uploaded (and directory access
  123. permission the parent directories). Likewise, if your
  124. spooler is going to be processing jobs which download
  125. files, then the user would need to be able to write to the
  126. local directories.
  127. <P>
  128. <P>
  129. Once you have created your spool directory with appropriate
  130. permissions    and    ownerships, you can run
  131. <I>ncftpspooler</I> <I>-d</I> to launch the spooler daemon. You can run
  132. additional spoolers if you want to process more than FTP
  133. job from the same job queue directory simultaneously. You
  134. can then monitor the log file (i.e., using <tt>tail -f</tt> ) to
  135. track the progress of the spooler. Most of the time it
  136. won't be doing anything, unless job files have appeared in
  137. the job queue directory.
  138. <P>
  139.  
  140. <H2><B>Job File Names</B></H2>
  141.  
  142. <P>
  143. When the <I>ncftpspooler</I> program monitors the job queue
  144. directory, it ignores any files that do not follow the
  145. naming convention for job files. The job files must be
  146. prefixed in the format of <I>X-YYYYMMDD-hhmmss</I> where <I>X</I>
  147. denotes a job type, <I>YYYY</I> is the four-digit year, <I>MM</I> is the
  148. two-digit month number, <I>DD</I> is the two-digit day of the
  149. month, <I>hh</I> is the two-digit hour of the day (00-23), <I>mm</I> is
  150. the two-digit minute, and <I>ss</I> is the two-digit second. The
  151. date and time represent the earliest time you want the job
  152. to be run.
  153. <P>
  154. <P>
  155. The job type can be <I>g</I> for a get (download from remote
  156. host), or <I>p</I> for aput (upload to remote host).
  157. <P>
  158. <P>
  159. As an example, if you wanted to schedule an upload to
  160. occur at 11:45 PM on December 7, 2001, a job file could be
  161. named
  162. <P>
  163. <ul>
  164. <tt>p-20011207-234500</tt>
  165. </ul>
  166. <P>
  167. In practice, the job files include additional information
  168. such as a sequence number or process ID. This makes it
  169. easier to create unique job file names. Here is the same
  170. example, with a process ID and a sequence number:
  171. <P>
  172. <ul>
  173. <tt>p-20011207-234500-1234-2</tt>
  174. </ul>
  175. <P>
  176. When submitting job files to the queue directory, be sure
  177. to use a dash character after the <I>hhmmss</I> field if you
  178. choose to append any additional data to the job file name.
  179. <P>
  180.  
  181. <H2><B>Job File Contents</B></H2>
  182.  
  183. <P>
  184. Job files are ordinary text files, so that they can be
  185. created by hand. Each line of the file is a key-pair in
  186. the format <I>variable</I>=<I>value</I>, or is a comment line beginning
  187. with an octothorpe character (<I>#</I>), or is a blank line.
  188. Here is an example job file:
  189. <P>
  190. <ul>
  191. <pre>
  192. # This is a NcFTP spool file entry.
  193. job-name=g-20011016-100656-008299-1
  194. op=get
  195. hostname=ftp.freebsd.org
  196. xtype=I
  197. passive=1
  198. remote-dir=pub/FreeBSD
  199. local-dir=/tmp
  200. remote-file=README.TXT
  201. local-file=readme.txt
  202. </pre>
  203. </ul>
  204. <P>
  205. Job files are flexible since they follow an easy-to-use
  206. format and do not have many requirements, but there are a
  207. few mandatory parameters that must appear for the spooler
  208. to be able to process the job.
  209. <P>
  210.  
  211. <UL><DL>
  212. <DT><I>op</I></DT>
  213. <DD>
  214. The operation (job type) to perform. Valid values
  215. are <I>get</I> and <I>put</I>.
  216. </DD>
  217.  
  218. <P>
  219. <DT><I>hostname</I></DT>
  220. <DD>
  221. The remote host to FTP to. This may be an IP
  222. address or a DNS name (i.e. ftp.example.com).
  223. </DD>
  224. </DL></UL>
  225.  
  226. <P>
  227. For a regular <I>get</I> job, these parameters are required:
  228.  
  229. <UL><DL>
  230. <DT><I>remote-file</I></DT>
  231. <DD>
  232. The pathname of the file to download from the
  233. remote server.
  234. </DD>
  235.  
  236. <P>
  237. <DT><I>local-file</I></DT>
  238. <DD>
  239. The pathname to use on the local server for the
  240. downloaded file.
  241. </DD>
  242. </DL></UL>
  243.  
  244. <P>
  245. For a regular <I>put</I> job, these parameters are required:
  246.  
  247. <P>
  248. <UL><DL>
  249. <DT><I>local-file</I></DT>
  250. <DD>
  251. The pathname of the file to upload to the remote
  252. server.
  253. </DD>
  254.  
  255. <P>
  256. <DT><I>remote-file</I></DT>
  257. <DD>
  258. The pathname to use on the remote server for the
  259. uploaded file.
  260. </DD>
  261. </DL></UL>
  262.  
  263. <P>
  264. For a recursive <I>get</I> job, these parameters are required:
  265.  
  266. <P>
  267. <UL><DL>
  268. <DT><I>remote-file</I></DT>
  269. <DD>
  270. The pathname of the file or directory to download
  271. from the remote server.
  272. </DD>
  273.  
  274. <P>
  275. <DT><I>local-dir</I></DT>
  276. <DD>
  277. The directory pathname to use on the local server
  278. to contain the downloaded items.
  279. </DD>
  280. </DL></UL>
  281.  
  282. <P>
  283. For a recursive <I>put</I> job, these parameters are required:
  284.  
  285. <P>
  286. <UL><DL>
  287. <DT><I>local-file</I></DT>
  288. <DD>
  289. The pathname of the file or directory to upload to
  290. the remote server.
  291. </DD>
  292.  
  293. <P>
  294. <DT><I>remote-dir</I></DT>
  295. <DD>
  296. The directory pathname to use on the remote server
  297. to contain the uploaded items.
  298. </DD>
  299. </DL></UL>
  300.  
  301. <P>
  302. The rest of the parameters are optional. The spooler will
  303. attempt to use reasonable defaults for these parameters if
  304. necessary.
  305.  
  306. <P>
  307. <UL><DL>
  308. <DT><I>user</I> </DT>
  309. <DD>   The username to use to login to the remote server.
  310. Defaults to ``anonymous'' for guest access.
  311. </DD>
  312.  
  313. <P>
  314. <DT><I>pass</I> </DT>
  315. <DD>   The password to use in conjunction with the username
  316. to login to the remote server.
  317. </DD>
  318.  
  319. <P>
  320. <DT><I>acct</I> </DT>
  321. <DD>   The account to use in conjunction with the username
  322. to login to the remote server. The need to
  323. specify this parameter is extremely rare.
  324. </DD>
  325.  
  326. <P>
  327. <DT><I>port</I> </DT>
  328. <DD>   The port number to use in conjunction with the
  329. remote hostname to connect to the remote server.
  330. Defaults to the standard FTP port number, 21.
  331. </DD>
  332.  
  333. <P>
  334. <DT><I>host-ip</I></DT>
  335. <DD>
  336. The IP address to use in conjunction with the
  337. remote hostname to connect to the remote server.
  338. This parameter can be used in place of the <I>host</I><B>_</B>n<I>ame</I>
  339. parameter, but one or the other must be used.
  340. This parameter is commonly included along with the
  341. <I>hostname</I> parameter as supplemental information.
  342. </DD>
  343.  
  344. <P>
  345. <DT><I>xtype</I></DT>
  346. <DD>
  347. The transfer type to use. Defaults to binary
  348. transfer type (TYPE I). Valid values are <I>I</I> for
  349. binary, <I>A</I> for ASCII text.
  350. </DD>
  351.  
  352. <P>
  353. <DT><I>passive</I></DT>
  354. <DD>
  355. Whether to use FTP passive data connections (PASV)
  356. or FTP active data connections (PORT). Valid values
  357. are <I>0</I> for active, <I>1</I> for passive, or <I>2</I> to try
  358. passive, then fallback to active. The default is
  359. <I>2</I>.
  360. </DD>
  361.  
  362. <P>
  363. <DT><I>recursive</I></DT>
  364. <DD>
  365. This can be used to transfer entire directory
  366. trees. By default, only a single file is transferred.
  367. Valid values are <I>yes</I> or <I>no</I>.
  368. </DD>
  369.  
  370. <P>
  371. <DT><I>delete</I></DT>
  372. <DD>
  373. This can be used to delete the source file on the
  374. source machine after successfully transferring the
  375. file to the destination machine. By default,
  376. source files are not deleted. Valid values are
  377. <I>yes</I> or <I>no</I>.
  378. </DD>
  379.  
  380. <P>
  381. <DT><I>job-name</I></DT>
  382. <DD>
  383. This isn't used by the program, but can be used by
  384. an entity which is automatically generating job
  385. files. As an example, when using the <I>-bbb</I> flag
  386. with <I>ncftpput</I>, it creates a job file on stdout
  387. with a <I>job-name</I> parameter so you can easily copy
  388. the file to the job queue directory with the suggested
  389. job name as the job file name.
  390. </DD>
  391.  
  392. <P>
  393. <DT><I>pre-ftp-command</I><BR>
  394. <I>post-ftp-command</I></DT>
  395. <DD>
  396. These parameters correspond to the <I>-W</I>, and <I>-Y</I>
  397. options of <I>ncftpget</I> and <I>ncftpput</I>. It is important
  398. to note that these refer to RFC959 File Transfer
  399. Protocol commands and <B>not</B> shell commands, nor commands
  400. used from within <tt>/usr/bin/ftp</tt> or <i>ncftp</i>.
  401. </DD>
  402.  
  403. <P>
  404. <DT><I>pre-shell-command</I><BR>
  405. <I>post-shell-command</I></DT>
  406. <DD>
  407. These parameters provide hooks so you can run a
  408. custom program when an item is processed by the
  409. spooler. Valid values are pathnames to scripts or
  410. executable programs. Note that the value must not
  411. contain any command-line arguments -- if you want
  412. to do that, create a shell script and have it run
  413. your program with the command-line arguments it
  414. requires.
  415. </DD>
  416. </DL></UL>
  417.  
  418. <P>
  419. Generally speaking, <I>post-shell-command</I> is much more useful
  420. than <I>pre-shell-command</I> since if you need to use these
  421. options you're more likely to want to do something after
  422. the FTP transfer has completed rather than before. For
  423. example, you might want to run a shell script which pages
  424. an administrator to notify her that her 37 gigabyte file
  425. download has completed.
  426. <P>
  427. <P>
  428. When your custom program is run, it receives on standard
  429. input the contents of the job file (i.e. several lines of
  430. <I>variable</I>=<I>value</I> key-pairs), as well as additional data the
  431. spooler may provide, such as a <I>result</I> key-pair with a textual
  432. description of the job's completion status.
  433. <P>
  434. <P>
  435. <I>post-shell-command</I> update a log file named
  436. <tt>/var/log/ncftp_spooler</tt>.
  437.  
  438. <ul>
  439. <pre>
  440. #!/usr/bin/perl -w
  441.  
  442. use strict;
  443.  
  444. my ($line);
  445. my (%params) = ();
  446.  
  447. while (defined($line = <STDIN>)) {
  448.     $params{$1} = $2 if ($line =~ /^([^=\#\s]+)=(.*)/);
  449. }
  450.  
  451. if ((defined($params{"result"})) && ($params{"result"} =~ /^Succeeded/)) {
  452.     open(LOG, ">> /var/log/ncftp_spooler.log") or exit(1);
  453.     print LOG "DOWNLOAD" if ($params{"op"} eq "get");
  454.     print LOG "UPLOAD" if ($params{"op"} eq "put");
  455.     print LOG " ", $params{"local-file"}, "\n";
  456.     close(LOG);
  457. }
  458. </pre>
  459. </ul>
  460.  
  461. <H2><B>Diagnostics</B></H2>
  462.  
  463. <P>
  464. The log file should be examined to determine if any <I>ncftpspooler</I>
  465. processes are actively working on jobs. The log
  466. contains copious amounts of useful information, including
  467. the entire FTP control connection conversation between the
  468. FTP client and server.
  469. <P>
  470.  
  471. <H2><B>Bugs</B></H2>
  472.  
  473. <P>
  474. The <I>recursive</I> option may not be reliable since <I>ncftpspooler</I>
  475. depends on functionality which may or may not be
  476. present in the remote server software. Additionally, even
  477. if the functionality is available, <I>ncftpspooler</I> may need
  478. to use heuristics which cannot be considered 100% accurate.
  479. Therefore it is best to create individual jobs for
  480. each file in the directory tree, rather than a single
  481. recursive directory job.
  482. <P>
  483. <P>
  484. For resumption of downloads to work, the remote server
  485. must support the FTP <I>SIZE</I> and <I>MDTM</I> primitives. Most modern
  486. FTP server software can do this, but there are still a
  487. number of bare-bones <I>ftpd</I> implementations which do not.
  488. In these cases, <I>ncftpspooler</I> will re-download the file in
  489. entirety each time until the download succeeds.
  490. <P>
  491. <P>
  492. The program needs to be improved to detect jobs that have
  493. no chance of ever completing successfully. There are
  494. still a number of cases where jobs can get spooled but get
  495. retried over and over again until a vigilant sysadmin manually
  496. removes the jobs.
  497. <P>
  498. <P>
  499. The spool files may contain usernames and passwords stored
  500. in cleartext. These files should not be readable by any
  501. user except the user running the program!
  502. <P>
  503.  
  504. <H2>Author</H2>
  505. <blockquote>
  506.  <P>
  507. Mike Gleason, <a href="http://www.ncftp.com">NcFTP Software</a>.
  508. </blockquote>
  509. <H2>See Also</H2>
  510. <blockquote>
  511.  <P>
  512. <I>ncftpput(1)</I>, <I>ncftpget(1),</I>
  513. <I>ncftp(1)</I>, <I>ftp(1)</I>, <I>rcp(1)</I>, <I>tftp(1)</I>. <P>
  514. <I>LibNcFTP</I>  (<a href="http://www.ncftp.com/libncftp/">http://www.ncftp.com/libncftp/</a>).
  515. </blockquote>
  516.  
  517. </BODY></HTML>
  518.